package ac.svn.accesscontrol.ui;

import java.awt.Color;

import javax.swing.Icon;
import javax.swing.JLabel;

import ac.svn.accesscontrol.store.IResources;
import ac.svn.accesscontrol.utils.Utility;

public class StatusLabel extends JLabel {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    public StatusLabel() {
    }

    public StatusLabel(String arg0) {
	super(arg0);
    }

    public StatusLabel(Icon arg0) {
	super(arg0);
    }

    public StatusLabel(String arg0, int arg1) {
	super(arg0, arg1);
    }

    public StatusLabel(Icon arg0, int arg1) {
	super(arg0, arg1);
    }

    public StatusLabel(String arg0, Icon arg1, int arg2) {
	super(arg0, arg1, arg2);
    }
    
    
    public void showErrorText(String text)
    {
	setText(text);
	setForeground(Color.RED.darker());
	setIcon(Utility.getImageIcon(IResources.LOC_ICN_ERROR));
    }
    
    public void showWarningText(String text)
    {
	setText(text);
	setForeground(Color.ORANGE.darker());
	setIcon(Utility.getImageIcon(IResources.LOC_ICN_INFORMATION));
    }
    
    public void showInformationText(String text)
    {
	setText(text);
	setForeground(Color.GREEN.darker().darker());
	setIcon(Utility.getImageIcon(IResources.LOC_ICN_INFORMATION));
    }
    
    public void setTextWithIcon(String text,String iconUri)
    {
	setText(text);
	setForeground(Color.GREEN.darker().darker());
	setIcon(Utility.getImageIcon(iconUri));	
    }
    
    public void setText(String text)
    {
	setIcon(null);
	setForeground(Color.BLACK);
	super.setText(text);
    }

}
